<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js</title>
	<style>
		.main{
			width:1200px;
			height:300px;
			/* background:#ccc; */
			margin:0 auto;

		}
		.left{
			padding:10px;
			width:550px;
			height:100%;
			
			float:left;
			border:1px dashed #000;
		}
		.right{
			padding:10px;
			width:550px;
			height:100%;
		
			float:right;
			border:1px dashed #000;
		}

		textarea{
			padding:5px;
			width:90%;
			height:100px;
		}
	</style>
</head>
<!-- 回到顶部 -->
<body>
	<div class="main">
		<div class="left">
			<p>用户名：</p>
			<p id='uid2'></p>
			
			<p>留言：</p>
			<p id='tid2'></p>
		</div>
		<div class="right">
			<form action="">
				<p>用户名：</p>
				<p><input type="text" id='uid' placeholder='username'></p>
				
				<p>留言：</p>
				<p><textarea name="" id="tid" cols="30" rows="10"></textarea></p>
				<p><input type="submit" value="ok"></p>
			</form>
		</div>
	</div>
</body>
<script>	
	uidobj=document.getElementById('uid');
	uidobj2=document.getElementById('uid2');
	uidobj.onkeyup=function(){//键盘弹起
		val=this.value;
		uidobj2.innerHTML=val;

	}

	tidobj=document.getElementById('tid');
	tidobj2=document.getElementById('tid2');
	tidobj.onkeyup=function(){
		val=this.value;
		tidobj2.innerHTML=val;

	}

</script>
</html>